﻿<!DOCTYPE html>
<!--隐患管理台账查询-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>

    <link href="/static/js/vue-treeselect/vue-treeselect.css" rel="stylesheet" />
    <script src="/static/js/vue-treeselect/vue-treeselect.js"></script>
    <script>

    </script>
    <style>
        .popupW100 .el-input-group__prepend {
        }

        .popupW50 .el-form-item__label {
            width: 80px !important;
        }

        .el-image img {
            width: 100px;
            height: 50px;
        }
    </style>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="popupW100">
        <el-row>
            <el-col :span="24">
                <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline" style="margin-bottom: 15px;">
                    <el-row>
                        <el-col class="head-tool">
                            <div class="new_title fl">
                                <strong><img src="/static/images/icon1.png" />制定整改计划</strong>
                            </div>
                            <span>
                                <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit"></btn>
                                <btn-export-list url="/api/YH_StandingBook/Export" :forminline="this.formInline"></btn-export-list>
                            </span>
                        </el-col>
                    </el-row>
                    <el-row>
                        <list-factorys-all v-model="formInline.model.CreateFactory" @change="factoryChange"></list-factorys-all>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RegionName+mark.m}}
                                        </template>
                                        <treeselect v-model="formInline.model.RiskRegion" :options="AreaList"
                                                    slot="suffix"
                                                    flat="true"
                                                    show-count="true"
                                                    style="line-height: 28px;"
                                                    placeholder="请选择" />
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RiskPosition+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.RiskPosition" slot="suffix"
                                                   :placeholder="RisksManagement.ExternalInspection.RiskPosition">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in RiskPosition" :label="item.jobPlace"
                                                       :value="item.id"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskManageAccountSel.Organizationlevel+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.OrganizationType" slot="suffix"
                                                   :placeholder="RisksManagement.RiskReport.OrganizationType">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in OrganizationType" :label="item.value"
                                                       :value="item.key">
                                            </el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.InspectTime+'开始'+mark.m}}
                                        </template>
                                        <el-date-picker v-model="formInline.model.TimeBegin" type="date"
                                                        slot="suffix" size="mini" placeholder="选择日期">
                                        </el-date-picker>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.InspectTime+'结束'+mark.m}}
                                        </template>
                                        <el-date-picker v-model="formInline.model.TimeEnd" type="date"
                                                        slot="suffix" size="mini" placeholder="选择日期">
                                        </el-date-picker>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.InspectType+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.InspectType" slot="suffix"
                                                   :placeholder="RisksManagement.ExternalInspection.InspectType">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in StandardType" :label="item.value"
                                                       :value="item.key">
                                            </el-option>
                                        </el-select>


                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RiskType+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.RiskType" slot="suffix"
                                                   :placeholder="RisksManagement.ExternalInspection.RiskType">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in RiskType" :label="item.value" :value="item.key">
                                            </el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RiskLevel+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.RiskLevel" slot="suffix"
                                                   :placeholder="RisksManagement.ExternalInspection.RiskLevel">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in RiskLevel" :label="item.value" :value="item.key">
                                            </el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.RiskManageAccountSel.RectificationDepartment+mark.m}}
                                        </template>
                                        <!-- :disable-branch-nodes="true"-->
                                        <treeselect v-model="formInline.model.Department"
                                                    :options="Department"
                                                    :flat="true"
                                                    :show-count="true"
                                                    slot="suffix"
                                                    style="line-height: 28px;"
                                                    placeholder="请选择" />

                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RectificationLeading+mark.m}}
                                        </template>
                                        <tree-department-staff-single slot="suffix" v-model="formInline.model.RectificationLeading" style="line-height:28px;"></tree-department-staff-single>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            状态:
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.State" slot="suffix"
                                                   :placeholder="RisksManagement.RiskManageAccountSel.State">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in StateList" :label="item.value" :value="item.key">
                                            </el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                </el-form>
                <el-table stripe ref="table" :data="ListItem.tableData" :height="ListItem.tableHeight" border
                          @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%">
                    <!--<el-table-column type="selection" align="center" min-width="55">
    </el-table-column>-->
                    <!---序号--->
                    <el-table-column type="index" :label="RisksManagement.ExternalInspection.id" width="50" align="center"
                                     show-overflow-tooltip="true" :index="indexMethod">
                    </el-table-column>
                    <!---隐患治理编号--->
                    <el-table-column prop="standingBookNo" min-width="150" align="center"
                                     show-overflow-tooltip="true" :label="RisksManagement.RiskReport.troubleNum">
                    </el-table-column>
                    <!---区域名称--->
                    <el-table-column prop="riskRegionText" show-overflow-tooltip="true" min-width="100" align="center"
                                     :label="RisksManagement.ExternalInspection.RegionName">
                    </el-table-column>

                    <!---隐患位置--->
                    <el-table-column prop="riskPositionText" show-overflow-tooltip="true" align="center"
                                     min-width="100" :label="RisksManagement.ExternalInspection.RiskPosition">
                    </el-table-column>

                    <!---组织类别--->
                    <el-table-column prop="organizationTypeText" show-overflow-tooltip="true" align="center"
                                     min-width="100" :label="RisksManagement.ExternalInspection.OrganizationType">
                    </el-table-column>

                    <!---检查时间--->
                    <el-table-column prop="discoveryTime" show-overflow-tooltip="true" min-width="100" :formatter="myformatDate" align="center"
                                     :label="RisksManagement.ExternalInspection.InspectTime">
                    </el-table-column>

                    <!---检查类别--->
                    <el-table-column prop="inspectTypeText" show-overflow-tooltip="true" align="center"
                                     min-width="100" :label="RisksManagement.ExternalInspection.InspectType">
                    </el-table-column>

                    <!---隐患描述--->
                    <el-table-column prop="riskDescription" show-overflow-tooltip="true" min-width="200" align="center"
                                     :label="RisksManagement.ExternalInspection.RiskDescription">
                    </el-table-column>

                    <!---隐患分类--->
                    <el-table-column prop="riskTypeText" show-overflow-tooltip="true" min-width="100" align="center"
                                     :label="RisksManagement.ExternalInspection.RiskType">
                    </el-table-column>

                    <!---隐患级别--->
                    <el-table-column prop="riskLevelText" show-overflow-tooltip="true" min-width="100" align="center"
                                     :label="RisksManagement.ExternalInspection.RiskLevel">
                    </el-table-column>

                    <!---整改目标或方案--->
                    <el-table-column prop="rectificationCase" show-overflow-tooltip="true" min-width="200" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.zgTargetOrPlan">
                    </el-table-column>


                    <!---整改资金（元）--->
                    <el-table-column prop="rectificationFund" show-overflow-tooltip="true" min-width="200" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.zgFunds">
                    </el-table-column>

                    <!---整改负责人--->
                    <el-table-column prop="rectificationLeadingName" show-overflow-tooltip="true" align="center"
                                     min-width="100" :label="RisksManagement.ExternalInspection.RectificationLeading">
                    </el-table-column>

                    <!---整改责任部门--->
                    <el-table-column prop="departmentName" show-overflow-tooltip="true" min-width="200" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.zgDepartment">
                    </el-table-column>

                    <!---计划完成时间--->
                    <el-table-column prop="planTime" show-overflow-tooltip="true" min-width="120" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.PlannedCompleTime">
                    </el-table-column>

                    <!---当前控制措施--->
                    <el-table-column prop="currentPlan" show-overflow-tooltip="true" min-width="200" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.CurrentControl">
                    </el-table-column>

                    <!---是否制定应急预案--->
                    <el-table-column prop="haveContingencyPlan" show-overflow-tooltip="true" min-width="200" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.EmergencyPlan">
                    </el-table-column>

                    <!---整改人--->
                    <el-table-column prop="rectificationerName" show-overflow-tooltip="true" min-width="200" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.Rectification">
                    </el-table-column>

                    <!---实际完成时间--->
                    <el-table-column prop="actualTime" show-overflow-tooltip="true" min-width="120" align="center" :formatter="myformatDate"
                                     :label="RisksManagement.RiskManageAccountSel.ActualCompletionTime">
                    </el-table-column>

                    <!---整改前照片--->
                    <el-table-column prop="" min-width="200" :label="RisksManagement.RiskManageAccountSel.BeforeRectification" align="center">
                        <template slot-scope="scope">
                            <el-image v-if="scope.row.yH_AttachmentBefore[0]" :src="host + '/api/file/DownLoad?id='+scope.row.yH_AttachmentBefore[0].attachment" fit="fill"></el-image>
                        </template>
                    </el-table-column>

                    <!---整改后照片--->
                    <el-table-column prop="" min-width="200" :label="RisksManagement.RiskManageAccountSel.CorrectedPhotos" align="center">
                        <template slot-scope="scope">
                            <el-image v-if="scope.row.yH_AttachmentAfter[0]" :src="host + '/api/file/DownLoad?id='+scope.row.yH_AttachmentAfter[0].attachment" fit="fill"></el-image>
                        </template>
                    </el-table-column>

                    <!---验收人--->
                    <el-table-column prop="acceptancerName" show-overflow-tooltip="true" min-width="100" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.Acceptor">
                    </el-table-column>

                    <!---验收时间--->
                    <el-table-column prop="appointTime" show-overflow-tooltip="true" min-width="100" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.AcceptanceTime">
                    </el-table-column>

                    <!---验收意见--->
                    <el-table-column prop="approvalResult" show-overflow-tooltip="true" min-width="200" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.AcceptOpinion">
                    </el-table-column>

                    <!---状态--->
                    <el-table-column prop="stateText" min-width="80" align="center"
                                     :label="RisksManagement.RiskManageAccountSel.State">
                    </el-table-column>
                    <!---操作--->
                    <el-table-column width="53" prop="update" :label="'操作'" fixed="right">
                        <template slot-scope="scope">
                            <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                                <i class="el-icon-edit"></i>
                            </button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-row type="flex" justify="end">
                    <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                                   :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes"
                                   :page-size="ListItem.pagesize" :layout="ListItem.layout" :total="ListItem.total">
                    </el-pagination>
                </el-row>
            </el-col>
        </el-row>
        <el-dialog :title="dialogTitle" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%"
                   height="80%" top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">
        Vue.component('treeselect', VueTreeselect.Treeselect)
        app = new Vue({
            el: '#app',
            data: function () {
                return {
                    dialogTitle: '',
                    //页面内左树
                    RiskRegion: null,
                    AreaList: [],
                    StateList: [],
                    OrganizationType: [],
                    RiskLevel: [],
                    RiskType: [],
                    StandardType: [],
                    RiskPosition: [],
                    RectificationLeading: [],
                    Department: [],
                    //页面内数据初始化
                    ListItem: ListItem,
                    formInline: {
                        model: {
                            RiskRegion: null,
                            RiskPosition: '',
                            OrganizationType: '',
                            TimeBegin: '',
                            TimeEnd: '',
                            InspectType: '',
                            RiskType: '',
                            RiskLevel: '',
                            Department: null,
                            RectificationLeading: null,
                            State: '',
                        },
                        offset: 0,
                        limit: 10
                    }
                }
            },
            watch: {
                RiskRegion: function (n, o) {
                    this.formInline.model.RiskPosition = null;
                    this.GetJobPlaceList();
                }
            },
            mounted: function () {

                //获取下拉菜单内容
                //this.getDepartmentData();//部门
                this.GetAreaList();//区域
                this.OrganizationType = getDicData('7835');//组织级别
                this.RiskType = getDicData('095036');//隐患分类
                this.RiskLevel = getDicData('03');//隐患等级
                this.StandardType = getDicData('102');//排查类型
                this.StateList = getDicData('6010');//状态
                //初始化数据
                //this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                factoryChange: function () {
                    this.getDepartmentData();
                    this.GetPageData(1);
                },
                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/YH_StandingBook/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Dialog展示
                UserInput: function (val, id) { DialogShow(this, val, "ExternalInspectionInput.html", id); },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/YH_StandingBook/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
                //序号排列方法
                indexMethod: function (index) { return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1; },
                //初始化区域下拉树
                GetAreaList: function (type) {
                    var mythis = this;
                    myAjax("post", this, '/api/SysArea/GetList', { model: { Name: '', Code: '', SubFactory: mythis.formInline.model.CreateFactory }, offset: 0, limit: 999 }
                        , function (response) {
                            mythis.AreaList = menuHelperX(response.data.pageData, guidEmpty);
                        },
                        false);
                },
                //初始化部门下拉树
                getDepartmentData: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/SysDepartment/GetList', { model: { Name: '', Code: '', CreateFactory: mythis.formInline.model.CreateFactory }, offset: 0, limit: 999 }, function (response) {
                        mythis.Department = menuHelperX(response.data.pageData, guidEmpty)
                    }, false);
                },
                //联动位置下拉
                GetJobPlaceList: function () {
                    var mythis = this;
                    if (this.RiskRegion) {
                        myAjax("get", this, '/api/SysJobPlace/GetJobPlaceList?id=' + this.RiskRegion, null, function (response) {
                            console.log(response.data)
                            mythis.RiskPosition = response.data
                        }, false);
                    }
                },
            }
        });
        //下拉树数据格式化
        function menuHelperX(list, pid) {
            var result = [];
            if (list.length <= 0)
                return list;
            list.forEach(function (v, i) {
                var temp = {};
                for (var key in v) {
                    temp[key] = v[key];
                }
                temp.label = v.name;
                temp.parentId = temp.parentId ? temp.parentId : guidEmpty;
                var obj;
                if (temp.parentId == pid) {
                    obj = temp;
                    var nextObj = menuHelperX(list, temp.id);
                    if (nextObj.length > 0) {
                        obj.children = nextObj;
                    }
                }
                if (obj)
                    result.push(obj)
            })
            return result;
        }
    </script>
</body>

</html>